मैं कुछ आर कोड चलाने की कोशिश कर रहा हूं और यह स्मृति के कारण क्रैश हो रहा है। त्रुटि है कि मैं मिलता है:mclapply लंबे वैक्टर अभी तक समर्थित नहीं हैं
StationUserX <- function(userNDX){
lat1 = deg2rad(geolocation$latitude[userNDX])
long1 = deg2rad(geolocation$longitude[userNDX])
session_user_id = as.character(geolocation$session_user_id[userNDX])
#Find closest station
Distance2Stations <- unlist(lapply(stationNDXs, Distance2StationX, lat1, long1))
# Return index for closest station and distance to closest station
stations_userX = data.frame(session_user_id = session_user_id,
station = ghcndstations$ID[stationNDXs],
Distance2Station = Distance2Stations)
stations_userX = stations_userX[with(stations_userX, order(Distance2Station)), ]
stations_userX = stations_userX[1:100,] #only the 100 closest stations...
row.names(stations_userX)<-NULL
return(stations_userX)
}
मैं mclapply 50 बार उपयोग करते हुए इस समारोह चलाएँ:
Error in sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) :
long vectors not supported yet: memory.c:3100
समारोह है कि मुसीबतों बनाता है निम्नलिखित है। StationUserX Distance2StationX 90k बार कॉल कर रहा है।
क्या फ़ंक्शन StationUserX को अनुकूलित करने का कोई स्पष्ट तरीका है?
क्या आपने यह देखने के लिए 'वेक्टरिज़' या 'cmpfun' ('कंपाइलर पैकेज में) का परीक्षण किया है, यह देखने के लिए कि क्या यह कोई आसान गति अप प्रदान करता है? –
समांतरता के लिए 'foreach' के बारे में भी सोचता है जो –